const express = require("express");
const apiRouter = express.Router();

// 编写路由
apiRouter.get("/get", (req, res) => {
  const query = req.query;
  res.send({
    status: 0,
    mag: "0:成功 1:失败",
    data: { ...query, addData: "get" },
  });
});
apiRouter.post("/post", (req, res) => {
  const body = req.body; // 获取body 需要中间件
  res.send({
    status: 0,
    mag: "0:成功 1:失败",
    data: { ...body, addData: "post" },
  });
});

module.exports = apiRouter;
